import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// import './registerServiceWorker'


import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/reset.css'
import 'element-ui/lib/theme-chalk/index.css'
Vue.use(ElementUI)

// 混入的数据信息
import "@/common/mixins"

Vue.config.productionTip = false

// 引入插件  Sweet弹框 
// import VueSweetalert2 from './common/sweetalert2'
// Vue.use(VueSweetalert2);

import swal from 'sweetalert2'
// 添加实例方法
Vue.prototype.$swal = swal



import "@/common/index.js" 



import Vant from "vant"
import 'vant/lib/index.css';
Vue.use(Vant)
import { Lazyload } from 'vant';

Vue.use(Lazyload);



import { Dialog } from 'vant';
Vue.use(Dialog);

import {DatetimePicker } from 'vant'
Vue.use(DatetimePicker)

// 全局组件注册 
import Components from './components';
Vue.use(Components);

// swiper 样式  
import "swiper/dist/css/swiper.min.css"



// 国际化
import {Locale} from 'vant'
import enUS from 'vant/lib/locale/lang/en-US'
import zhCN from 'vant/lib/locale/lang/zh-CN'



// wow动画
import "wowjs/css/libs/animate.css"
import "animate.css"


// Axios 
import axios from './api/request'
Vue.prototype.$http = axios;

import {Ajax} from './api'
Vue.prototype.$ajax = Ajax;

// mock
// import { mockXHR } from '../mock/index'
// mockXHR() 

import SlideVerify from "vue-monoplasty-slide-verify";
Vue.use(SlideVerify);

import 'lib-flexible' 

// 公共样式
import './styles/common-style.scss'


// 事件总线
import {bus} from './common/bus'
Vue.prototype.$bus = bus;

Array.from(document.getElementsByClassName('el-select')).forEach((item) => {
  item.children[0].children[0].removeAttribute('readOnly')
  item.children[0].children[0].onblur = function () {
    let _this = this
    setTimeout(() => {
      _this.removeAttribute('readOnly')
    }, 200)
  }
})

new Vue({
  router,
  store,
  render: h => h(App),
  watch:{
    '$route':(to,from)=>{

      localStorage.setItem('fromPath',localStorage.getItem('toPath'))
      localStorage.setItem('toPath',to.path)

      
      store.commit('changeFromPath',store.state.toPath)
      store.commit('changeToPath',to.path)

    }
  }
}).$mount('#app')
